#include <iostream>

#include <cstdlib>

#include <sys/types.h>
#include <unistd.h>
#include <signal.h>

void ChangeSignOperator(int signum)
{
    std::cout << "process get sign: " << signum << std::endl;
}

int main()
{
    signal(SIGINT, ChangeSignOperator);
    signal(SIGABRT, ChangeSignOperator);
    
    for (int i = 1; true; ++i)
    {
        std::cout << "I am crazy process, pid: " << getpid() << std::endl;
        sleep(1);
        if (i % 5 == 0)
        {
            //raise(2);   //kill(getpid(), 2);
            abort();    //kill(getpid(), 6);    //raise(6);
        }
    }
    return 0;
}